home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / glibc-1.09 / glibc-1 / glibc-1.09.1 / misc / sys / cdefs.h next >
Encoding:
C/C++ Source or Header  |  1996-05-27  |  3.3 KB  |  117 lines

  1. /* Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. #ifndef    _SYS_CDEFS_H
  20.  
  21. #define    _SYS_CDEFS_H    1
  22. #include <features.h>
  23.  
  24. /* Some user header file might have defined this before.  */
  25. #undef    __P
  26.  
  27. #ifdef __GNUC__
  28.  
  29. #define    __P(args)    args    /* GCC can always grok prototypes.  */
  30. #define    __DOTS        , ...
  31.  
  32. /* In GCC versions before 2.5, the `volatile' and `const' keywords have
  33.    special meanings when applied to functions.  In versions 2.5 and 2.6,
  34.    the `__attribute__' syntax used below does not work properly.  */
  35. #if    __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
  36. #define    __NORETURN    __volatile
  37. #define    __CONSTVALUE    __const
  38.  #elif 0 /* XXX */
  39. /* In GCC 2.5 and later, these keywords are meaningless when applied to
  40.    functions, as ANSI requires.  Instead, we use GCC's special
  41.    `__attribute__' syntax.  */
  42. #define    __NORETURN    __attribute__ ((__volatile__))
  43. #define    __CONSTVALUE    __attribute__ ((__const__))
  44. #else
  45. #define __NORETURN
  46. #define __CONSTVALUE
  47. #endif
  48.  
  49. #else    /* Not GCC.  */
  50.  
  51. #define    __inline        /* No inline functions.  */
  52. #define    __NORETURN        /* No way to say functions never return.  */
  53. #define    __CONSTVALUE        /* No way to say functions are functional.  */
  54.  
  55. #if (defined (__STDC__) && __STDC__) || defined (__cplusplus)
  56.  
  57. #define    __P(args)    args
  58. #define    __const        const
  59. #define    __signed    signed
  60. #define    __volatile    volatile
  61. #define    __DOTS        , ...
  62.  
  63. #else    /* Not ANSI C or C++.  */
  64.  
  65. #define    __P(args)    ()    /* No prototypes.  */
  66. #define    __const            /* No ANSI C keywords.  */
  67. #define    __signed
  68. #define    __volatile
  69. #define    __DOTS
  70.  
  71. #endif    /* ANSI C or C++.  */
  72.  
  73. #endif    /* GCC.  */
  74.  
  75. /* For these things, GCC behaves the ANSI way normally,
  76.    and the non-ANSI way under -traditional.  */
  77.  
  78. #if defined (__STDC__) && __STDC__
  79.  
  80. #define    __CONCAT(x,y)    x ## y
  81. #define    __STRING(x)    #x
  82.  
  83. /* This is not a typedef so `const __ptr_t' does the right thing.  */
  84. #define __ptr_t void *
  85. typedef long double __long_double_t;
  86.  
  87. #else
  88.  
  89. #define    __CONCAT(x,y)    x/**/y
  90. #define    __STRING(x)    "x"
  91.  
  92. #define __ptr_t char *
  93. typedef double __long_double_t;
  94.  
  95. #endif
  96.  
  97. /* The BSD header files use the ANSI keywords unmodified.  (This means that
  98.    old programs may lose if they use the new keywords as identifiers.)  We
  99.    define them to their __ versions, which are taken care of above.  */
  100.  
  101. #ifdef    __USE_BSD
  102. #define    const        __const
  103. #define    signed        __signed
  104. #define    volatile    __volatile
  105. #endif
  106.  
  107. /* C++ needs to know that types and declarations are C, not C++.  */
  108. #ifdef    __cplusplus
  109. #define    __BEGIN_DECLS    extern "C" {
  110. #define    __END_DECLS    }
  111. #else
  112. #define    __BEGIN_DECLS
  113. #define    __END_DECLS
  114. #endif
  115.  
  116. #endif     /* sys/cdefs.h */
  117.